<!-- Message Error -->
<?php if ($this->session->flashdata('f_products_photo')): ?>
    <div class="msg msg-ok boxwidth">
        <p><strong><?php echo $this->session->flashdata('f_products_photo'); ?></strong></p>
    </div>
<?php endif; ?>

<!-- Box -->
<div class="box">
    <!-- Box Head -->
    <div class="box-head">
        <h2>Manage <?php echo $product->name;?> Photo</h2>
    </div>
    <!-- End Box Head -->
    
    <!-- Table -->
    <div class="table">
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
                <th>Image</th>
                <th>File Name</th>
                <th width="110" class="ac">Control</th>
            </tr>
            <?php $i=0;?>
            <?php foreach($photos->result() as $p):?>
            <tr <?php echo (($i++%2)!=0)?'class="odd"':'';?>>
                <td><img class="admin-product-photo" src="<?php echo base_url();?>photo/products/<?php echo $p->link;?>"/></td>
                <td><?php echo $p->link;?></td>
                <td style="text-align: center"><a href="<?php echo base_url();?>admin/products/photo_delete/<?php echo $product->id;?>/<?php echo $p->id;?>" class="ico del column_delete">Delete</a></td>
            </tr>
            <?php endforeach;?>
        </table>

    </div>
    <!-- Table -->
    
    <form action="<?php echo base_url();?>admin/products/photo_add" method="post" enctype="multipart/form-data">

        <!-- Form -->
        <div class="form">
            <p>
                <label>Add Photo</label>
                <input type="file" class="field size1" name="photo"/>
                <input type="hidden" class="field size1" name="products_id" value="<?php echo $product->id;?>"/>
            </p>
        </div>
        <!-- End Form -->
        
        <!-- Form Buttons -->
        <div class="buttons">
            <input type="submit" class="button" value="Add" />
        </div>
        <!-- End Form Buttons -->
    </form>
    
</div>
<!-- End Box -->